# Contributor: Laurent Bercot <ska-devel@skarnet.org>
# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
pkgname=mdevd
pkgver=0.1.6.3
pkgrel=0
pkgdesc="A netlink-listening device manager using mdev's configuration files"
url=https://skarnet.org/software/mdevd/
arch="all"
license="ISC"
options="!check"  # no tests provided
depends_openrc="mdevd mdev-conf"
makedepends="linux-headers skalibs-dev>=2.14"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://skarnet.org/software/mdevd/mdevd-$pkgver.tar.gz
	$pkgname.initd
	mdevd-init.initd"

build() {
	./configure \
		--enable-shared \
		--enable-static \
		--disable-allstatic
	make
}

package() {
	make install DESTDIR="$pkgdir"
	mkdir -p "$pkgdir/usr/share/doc" "$pkgdir/etc/init.d"
	cp -a doc "$pkgdir/usr/share/doc/$pkgname"
	install -m 755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m 755 "$srcdir"/mdevd-init.initd "$pkgdir"/etc/init.d/mdevd-init
}

openrc() {
	provides="dev-openrc"
	provider_priority=20
	default_openrc
}

sha512sums="
2962be689858117960aa5b332bbc7ca31c2d6592bae1c10acb35a7d66e4bf093cc70d2966649b742ce10ab3ac252b49a4b86b2c548355544aae65ca6214cdaf1  mdevd-0.1.6.3.tar.gz
3d826495788b1530548e090675f91fe4828f78a95b3b24cb4c73b92f5d5c16b103e6c25a2591d2d0bd17da2d16fa59d1214e70d936930f25cd9872dfd202585b  mdevd.initd
a1e4734b1ad1a508da6c035aa9523a465cfd44489cceb7552f3b6e94ca8b8fb39e6baa3b230388ff9e89c1edbdcac5682f4c636b9fe52d94a92ac98f55bdd972  mdevd-init.initd
"
